package com.serv.common.service.sys;

import com.jfinal.plugin.activerecord.Page;
import com.serv.common.base.BaseService;
import com.serv.common.model.sys.Role;
import com.serv.util.Condition;

public class RoleService extends BaseService<Role> {

	protected RoleService() {
		this.dao = Role.dao;
	}
	
	public Page<Role> paginate(int pageNum,int pageSize,Condition condition){
		String conds = condition.getConds();
		Object[] params = condition.getParams();
		
		if (conds.length() > 0)
			conds = " WHERE " + conds;
		String orderBy = condition.getOrderBy();
		
		String select = "SELECT *";
		String sqlExceptSelect = "FROM sys_role" + conds + orderBy;
		
		return dao.paginate(pageNum, pageSize, select, sqlExceptSelect, params);
	}
}
